package com.jewel.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jewel.mapper.CartMapper;
import com.jewel.pojo.Cart;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CartServiceImpl implements ICartService {
    @Autowired
    private CartMapper mapper;


    @Override
    public List<Cart> list() {
        return mapper.selectList(new QueryWrapper<>());
    }

    @Override
    public Cart getById(Integer id) {
        return mapper.selectById(id);
    }

    @Override
    public Integer add(Cart cart) {
        return mapper.insert(cart);
    }

    @Override
    public Integer update(Cart cart) {
        return mapper.updateById(cart);
    }

    @Override
    public Integer delete(Integer id) {
        return mapper.deleteById(id);
    }

}
